package com.slz3.business.module.configManagement.conSiteProvince.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class ConSiteProvinceFactory {

    /**
     * 初始化基础属性值
     */
    public static ConSiteProvince initBaseFields(ConSiteProvince conSiteProvince) {
        if (conSiteProvince.getUuid() == null) {
            conSiteProvince.setUuid(UUIDUtils.generateUUID());
            conSiteProvince.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(conSiteProvince.getSerAudit())) {
                conSiteProvince.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(conSiteProvince.getSerUsing())) {
                conSiteProvince.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            conSiteProvince.setLastModifyTime(LocalDateTime.now());
        }
        return conSiteProvince;
    }

    /**
     * 初始化基础属性值
     */
    public static ConSiteProvince initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static ConSiteProvince newTemStyle() {
        return new ConSiteProvince();
    }

}
